#pragma once
#include <CL\cl.hpp>
#include "OpenCLWork.h"
#include <iostream>
#include "def.h"
typedef unsigned char byte;
class NBody :
	public OpenCLWork
{
private:
	int offset;
	cl_float5* points;
	int size;
	cl::CommandQueue queue;

	cl::Buffer buffer_points;
	cl::Buffer buffer_n;
	cl::Context context;
	cl::Device device;
	cl::Kernel kernel_nBody;
	cl::Program program;
	cl::Event event;
	int pieces;
	int* n;
public:
	NBody(cl_float5*, int);
	NBody(cl::Device, cl_float5*, int);
	~NBody();
	void change(cl_float5*, int);
	bool startWork(int, int);
	void exchange(int, int);
	void quicksort(int, int);
	void sort(int*, int);
	void finish();
	NBody* copy();
	NBody* copy(cl::Device);
};

